package numberFour;

import java.time.Period;
import java.util.concurrent.*;

public class NumberFour {
    public static void main(String[] args) {
        MMath mMath=new MMath();
        ExecutorService executorService=new ThreadPoolExecutor(
                2,
                5,
                3,
                TimeUnit.SECONDS,
                new ArrayBlockingQueue<>(5),
                Executors.defaultThreadFactory(),
                new ThreadPoolExecutor.CallerRunsPolicy()
        );
        Future<Integer> submit = executorService.submit(mMath);
        try {
            System.out.println(submit.get());
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        } catch (ExecutionException e) {
            throw new RuntimeException(e);
        }
    }
}
